import React from 'react';
import { Form, Button, Icon, Input, Breadcrumb, Table, Pagination, message, Row, Col, Modal, Upload, Select, DatePicker,InputNumber } from 'antd';
import $ from 'jquery';
import Config from '../../common/config';
import moment from 'moment';
import { error } from 'util';

const config = new Config();
const FormItem = Form.Item;
const Option = Select.Option;
const RangePicker = DatePicker.RangePicker;

let banner_pic = '';
let img = '';

let ad ='a';
let ads = 'a';


const props = {
    name: 'file',
    action: `${config.wechat}/upload/img`,
    headers: {
        'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
    },
    beforeUpload(info) {
        console.log(info)
        const isLt3M = info.size / 1024 / 1024 <= 3;
        if (!isLt3M) {
            alert('请上传大小不超过3MB的图片!');
            return false;
        }
        const isJPG = info.type === 'image/jpeg' || info.type === 'image/jpg'|| info.type === 'image/png'|| info.type === 'image/svg'|| info.type === 'image/psd';
        if (!isJPG) {
            message.error('上传文件格式不正确');
            return false;
        }
        return true;
    },
    onChange(info) {
        if (info.file.status !== 'uploading') {
            console.log(info.file, info.fileList);
        }
        if (info.file.status === 'done') {
            img2base64(info.file.response.ImgUrl).then(
                as =>{
                   if(as) {
                        banner_pic = info.file.response.ImgUrl;
                        ad ='a';
                        message.success('图片上传成功');
                   }else {
                        ad ='b';
                       message.error('上传图片请按照图片宽高上传');
                   }
                }).catch(error => {
                    console.log(error);
                })
            
        } else if (info.file.status === 'error') {
            console.log(info.file)
        }
    },
};

const propss = {
    name: 'file',
    action: `${config.wechat}/upload/img`,
    headers: {
        'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
    },
    beforeUpload(info) {
        
        const isLt3M = info.size / 1024 / 1024 <= 3;
        if (!isLt3M) {
            alert('请上传大小不超过3MB的图片!');
            return false;
        }
        const isJPG = info.type === 'image/jpeg' || info.type === 'image/jpg'|| info.type === 'image/png'|| info.type === 'image/svg'|| info.type === 'image/psd';
        if (!isJPG) {
            message.error('上传文件格式不正确');
            return false;
        }
        return true;
    },
    onChange(info) {
        console.log(info)
        if (info.file.status !== 'uploading') {
            console.log(info.file, info.fileList);
        }
        if (info.file.status === 'done') {
            img2base(info.file.response.ImgUrl).then(
                 as =>{
                    if(as) {
                        img = info.file.response.ImgUrl;
                        ads = 'a';
                        message.success('图片上传成功');
                    }else {
                        ads = 'b';
                        message.error('上传图片请按照图片宽高上传');
                    }
                 }).catch(error => {
                     console.log(error);
                 })
            
        } else if (info.file.status === 'error') {
            this.state.img = '';
        }
    },
};
function img2base64(url) {
    return new Promise(resolve => {
        const imgs = new Image();
        imgs.src = url;
        imgs.onload = () => {
            console.log('kuan:'+imgs.width,'gao:'+imgs.height)

            let a = imgs.width / imgs.height;
            let b = 690 /290;
            if(a == b) {
                resolve(true);
            } else {
                resolve(false);
            }

        };

       
    });
}

function img2base(url) {
    return new Promise(resolve => {
        const imgs = new Image();
        imgs.src = url;
        imgs.onload = () => {
            console.log('kuan:'+imgs.width,'gao:'+imgs.height)

            let a = imgs.width / imgs.height;
            let b = 750 /810;
            if(a == b) {
                resolve(true);
            } else {
                resolve(false);
            }

        };

       
    });
}
class LoginComponent extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            expression: '', //
            confirmDirty: false, //
            activityList: [],//活动列表
            activitycount: 0,//活动列表条数
            pageindex: 1,//当前页码
            visible: false,//新增活动模态框显示与隐藏标志
            fileList: '', //图片属性
            fileLists: '', //跳转图片属性
            banner_pic: '',
            url: { display: "none" }, //显示url
            mark: { display: "none" }, //显示url
            imgs: { display: "none" }, //显示图片
            img: '', //
            divs: { display: "none" },
            data: '', //编辑数据
            action: 1, //1 为新增   2编辑
            activityAll: [], //活动
            status: '1',
            time: { display: "none" }, //显示url
            time_start: '',//默认时间
            time_end: '',
            aa: { display: "none" },
            time1: { display: "none" }, //条件时间
            visibles:false, //排序模态框
            seq:'',//排序数值
            ids:'',//id
            pic_num :'1',

        }
    }

    componentDidMount() {
        this.getBennnerList();
        //   this.getActivityList();
    }

    //获取活动列表
    getBennnerList(pageindex) {
        let _this = this;
        let data = this.props.form.getFieldsValue();
        let query = {};
        if (data.activity_status != 'a') {
            query.activity_state = data.activity_status
        }
        if (data.activity_namess) {
            query.activity_name = data.activity_namess;
        }
        if (data.activity_time == 1) {
            if (data.times == undefined) {
                return message.error(`'您选择咯限时请选择时间 请返回重新操作`, 2);
            }
            query.activity_star = moment(data.times[0]).format("YYYY-MM-DD HH:mm:ss");
            query.activity_end = moment(data.times[1]).format("YYYY-MM-DD HH:mm:ss");
        }
        if (data.activity_time == 0) {
            query.activity_star = 'a';
            query.activity_end = null;
        }
        query.pagesize = 20;
        query.pageindex = pageindex || 1;
        let url = `${config.wechat}/activitymanage/findManageList`;

        $.ajax({
            url: url,
            type: "POST",
            async: true,

            headers: {
                'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
            },
            data: query,
            success(data) {
                console.log(data);
                if (data.code === 200) {
                    _this.setState({
                        activityList: data.rows,
                        activitycount: data.count,
                    })
                } else {
                    message.error(`${data.mes} 请返回重新操作`, 2);
                }
            },
            error(data) {
                console.log(data);
            }
        });

    }

    //提交登录表单
    handleSubmit(e) {
        e.preventDefault();
        this.props.form.validateFields((err, values) => {
            if (!err) {
                if (this.state.action == 1) {
                    if(ad == 'b') {
                        return   message.error(`'上传图片请按照图片宽高上传 请返回重新操作`, 2); 
                    }
                    if (banner_pic == '' || banner_pic == undefined) {
                        return message.error(`'您没有上传活动图 请返回重新操作`, 2);
                    }

                    let querys = {};
                    querys.banner_img = banner_pic;
                    querys.type = values.type;
                    querys.time = values.status;
                    querys.activity_name = values.activity_name;

                    if (values.type == 2) {
                        if(ads == 'b') {
                            return   message.error(`'上传图片请按照图片宽高上传 请返回重新操作`, 2); 
                        }
                        if (img == '' || img == undefined) {
                            return message.error(`'您没有上传详情图 请返回重新操作`, 2);
                        }
                        querys.img = img;

                    }
                    if (values.type == 3) {
                        if (values.url == '' || values.url == undefined) {
                            return message.error(`'您没有填写url 请返回重新操作`, 2);
                        }
                        querys.url = values.url;
                    }
                    if (values.status == 2) {
                        querys.activity_star = moment(values.time_range[0]).format("YYYY-MM-DD HH:mm:ss");
                        querys.activity_end = moment(values.time_range[1]).format("YYYY-MM-DD HH:mm:ss");
                    } else {
                        querys.activity_state = 1;
                    }
                    $.ajax({
                        url: `${config.wechat}/activitymanage/addactivity`,
                        type: "post",
                        headers: {
                            'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
                        },
                        async: true,
                        data: querys,
                        success: res => {
                            if (res.code === 200) {
                                banner_pic = '';
                                img = '';
                                ad = 'a';
                                ads = 'a';
                                this.props.form.resetFields();
                                this.setState({ visible: false });

                                this.setState({ url: { display: "none" }, imgs: { display: "none" }, divs: { display: "none" }, visible: false, time: { display: "none" }, fileList: '', fileLists: '' });
                                this.getBennnerList();
                                message.success(res.mes)
                            } else {
                                message.error(`${res.mes} 请返回重新操作`, 2);
                            }
                        }
                    });
                } else {
                    let query = {};
                    if (banner_pic != '' && banner_pic != undefined) {
                        query.banner_img = banner_pic;
                    }

                    query.type = values.type;
                    query.time = values.status;
                    query.activity_name = values.activity_name;

                    if (values.type == 2) {
                        if (img != '' && img != undefined) {
                            query.img = img;
                        }
                    }
                    if (values.type == 3) {
                        if (values.url == '' || values.url == undefined) {
                            return message.error(`'您没有填写url 请返回重新操作`, 2);
                        }
                        query.url = values.url;
                    }

                    if (values.status == 2) {
                        query.activity_star = moment(values.time_range[0]).format("YYYY-MM-DD HH:mm:ss");
                        query.activity_end = moment(values.time_range[1]).format("YYYY-MM-DD HH:mm:ss");
                    } else {
                        query.activity_state = 1;
                    }

                    $.ajax({
                        url: `${config.wechat}/activitymanage/addactivity?id=` + this.state.data.id,
                        type: "put",
                        async: true,
                        data: query,
                        headers: {
                            'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
                        },
                        success: res => {

                            if (res.code === 200) {
                                banner_pic = '';
                                img = '';
                                ad = 'a';
                                ads = 'a';
                                this.props.form.resetFields();
                                this.setState({ visible: false, data: '' });
                                this.setState({ url: { display: "none" }, imgs: { display: "none" }, divs: { display: "none" }, visible: false, time: { display: "none" }, fileList: '', fileLists: '' });
                                this.getBennnerList();
                                message.success(res.mes)
                            } else {
                                message.error(`${res.mes} 请返回重新操作`, 2);
                            }
                        }
                    });
                }

            }
        });
    }

    //分页
    changePage(pageindex) {
        this.setState({
            pageindex
        });
        this.getBennnerList(pageindex);
    }
    //取消，关闭对话框
    handleCancel() {
        this.setState({
            visible: false,
            status:'1',
        });
        this.setState({ url: { display: "none" }, imgs: { display: "none" }, divs: { display: "none" }, visible: false, time: { display: "none" }, fileList: '', fileLists: '' });
        banner_pic = '';
        img = '';
        ad = 'a';
        ads = 'a';
    }

    //取消，关闭排序对话框
    handleCancels() {
        this.setState({
            visibles: false,
        });
    }
    //修改排序
    seq(){
        let data = this.props.form.getFieldsValue();
        if(!data.seqs) {
            return message.error(`'请填写序号 请返回重新操作`, 2);
        }
        if(data.seqs < 1 || data.seqs> 99) {
            return message.error(`填写序号范围有误 `, 2);
        }
        let query = {seq:data.seqs,id:this.state.ids}
        $.ajax({
            url: `${config.wechat}/activitymanage/seq`,
            type: "put",
            headers: {
                'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
            },
            async: true,
            data: query,
            success: res => {
                if (res.code === 200) {
                    this.props.form.resetFields();
                    this.setState({ visibles: false });
                    this.getBennnerList();
                    message.success(res.mes)
                } else {
                    message.error(`${res.mes} 请返回重新操作`, 2);
                }
            }
        });
    }
    //图片上传
    normFile(e) {
        if (Array.isArray(e)) {
            return e;
        }
        this.setState({ fileList: e.fileList });
        //return e && e.fileList;
    }
    normFiles(e) {
        if (Array.isArray(e)) {
            return e;
        }
        this.setState({ fileLists: e.fileList });
        //return e && e.fileList;
    }
    handleSelectChange(value) {
        if (value === '2') {
            this.setState({ url: { display: "none" }, imgs: { display: "block" }, });
        }
        if (value === '3') {
            this.setState({ url: { display: "block" }, imgs: { display: "none" } });
        }

    };
    handleSelectChanges(value) {
        if (value === '1') {
            this.setState({ time: { display: "none" } });
        }
        if (value === '2') {
            this.setState({ time: { display: "block" } });
        }

    }
    devs() {
        this.setState({ devs: { display: "block", height: 70 } })
    }
    //编辑页面
    edit(data) {
        console.log(data)
        data.status = String(data.status);
        data.type = String(data.type);


        if (data.type == 2) {
            this.setState({ url: { display: "none" }, imgs: { display: "block" }, });
        } else if (data.type == 3) {
            this.setState({ url: { display: "block" }, imgs: { display: "none" } });
        } else {
            this.setState({ url: { display: "none" }, imgs: { display: "none" } });
        }
        if (data.time == 2) {

            this.setState({
                status: '2', time_start: moment(moment(data.activity_star).format('YYYY-MM-DD HH:mm:ss'), 'YYYY-MM-DD HH:mm:ss'),
                time_end: moment(moment(data.activity_end).format('YYYY-MM-DD HH:mm:ss'), 'YYYY-MM-DD HH:mm:ss')
            });
            this.setState({ time: { display: "block" } })
        } else {
            this.setState({ status: '1' });
        }
        this.setState({ data: data, devs: { display: "block", height: 70 }, visible: true, action: 2 })
        this.setState({
            fileList: [{
                uid: -1,
                name: '',
                status: 'done',
                url: data.banner_img,
            }]
        });
        if (data.type == 2) {
            this.setState({
                fileLists: [{
                    uid: -1,
                    name: '',
                    status: 'done',
                    url: data.img,
                }]
            });
        }

    }
    //删除
    delete(data) {
        $.ajax({
            url: `${config.wechat}/sowing/banner?id=` + data.id,
            type: "delete",
            async: true,

            success: res => {
                if (res.code === 200) {
                    this.getBennnerList();
                    message.success(res.mes)
                } else {
                    message.error(`${res.mes} 请返回重新操作`, 2);
                }
            }
        });
    }
    //修改状态
    status(data) {
        let num;
        if (data.activity_state == 0) {
            num = 9;
        }
        if (data.activity_state == 9) {
            num = 2;
        }
        $.ajax({
            url: `${config.wechat}/activitymanage/status?id=` + data.id,
            headers: {
                'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
            },
            type: "put",
            async: true,
            data: { num: num },
            success: res => {
                if (res.code === 200) {
                    this.getBennnerList();
                    message.success(res.mes)
                } else {
                    message.error(`${res.mes} 请返回重新操作`, 2);
                }
            }
        });
    }

    getActivityList() {
        let url = `${config.wechat}/activitymanage/activity/findAll`;
        $.ajax({
            url: url,
            type: "GET",
            async: true,
            headers: {
                'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
            },
            // data: {
            //     activity_state: 1,
            // },
            success: data => {
                if (data.code === 200) {
                    this.setState({
                        activityAll: data.data,
                    })
                } else {
                    message.error(`${data.mes} 请返回重新操作`, 2);
                }
            }
        });
    }
    handleTime(value) {
        if (value == 1) {
            this.setState({ time1: { display: "block" } })
        }
        if (value == 0) {
            this.setState({ time1: { display: "none" } })
        }
    }
    submitReset(e) {
        this.props.form.resetFields();

    }
    seqs(data){
        this.setState({seqs:data.seq,visibles:true,ids:data.id})
    }

    render() {
        const { getFieldDecorator } = this.props.form;
        const columns = [
            {
                title: 'ID',
                dataIndex: 'id',
                width: 100,
            },
            {
                title: '图片',
                key: 'banner_img',
                width: 100,
                render: (text, record) => (
                    <img src={record.banner_img} alt=""
                        style={{ maxWidth: "50px", height: "auto" }} />
                ),
            },
            {
                title: '活动名',
                dataIndex: 'activity_name',
                width: 100,
            },
            {
                title: '创建人',
                dataIndex: 'c_user',
                width: 100,
            },
            {
                title: '状态',
                dataIndex: 'activity_state',
                width: 100,
                render: text => <span>{text == 0 ? '未发布' : text == 9 ? '已发布' : text === 2 ? '已下架' : ''}</span>
                // render: text => <span>{text == 1 ? '不显示' : '显示'}</span>

            },
            {
                title: '开始时间',
                dataIndex: 'activity_star',
                width: 100,
                render: (text, record) => (
                    <div>
                        {record.activity_star === null ? '不限时间' : moment(record.activity_star).format('YYYY-MM-DD HH:mm:ss')}
                    </div>
                )
            },
            {
                title: '结束时间',
                dataIndex: 'activity_end',
                width: 100,
                render: (text, record) => (
                    <div>
                        {record.activity_end === null ? '不限时间' : moment(record.activity_end).format('YYYY-MM-DD HH:mm:ss')}
                    </div>
                )
            },
            {
                title: '详情',
                dataIndex: 'seq1',
                width: 100,
                render: function (text, record) {
                    if (record.type == 1) {
                        return '无'
                    } else if (record.type == 2) {
                        return <img src={record.img} alt=""
                            style={{ maxWidth: "50px", height: "auto" }} />
                    } else {
                        return record.url
                    }
                }.bind(this)
            },
            {
                title: '序号',
                dataIndex: 'seq',
                width: 100
            }, {
                title: '最后修改时间',
                dataIndex: 'updatedAt',
                width: 100,
                render: (text, record) => (
                    <div>
                        {moment(record.updatedAt).format('YYYY-MM-DD HH:mm:ss')}
                    </div>
                )
            }, {
                title: '操作',
                width: 200,

                render: (text, record) => (
                    <div>
                        <Button type="primary" onClick={this.edit.bind(this, record)} style={record.activity_state == 0 || record.activity_state == 2 ? { display: "inline" } : this.state.aa}>编辑</Button>&nbsp;&nbsp;
                        <Button type="danger" onClick={this.status.bind(this, record)} style={record.activity_state == 9 ? { display: "inline" } : this.state.aa}>下架</Button>&nbsp;&nbsp;
                        <Button type="dashed" onClick={this.status.bind(this, record)} style={record.activity_state == 0 ? { display: "inline" } : this.state.aa}>发布</Button>&nbsp;&nbsp;
                        <Button type="primary"  onClick={this.seqs.bind(this,record)} style = {record.activity_state == 9?{display:"inline"}:this.state.aa}>编辑序号</Button>&nbsp;&nbsp;

                    </div>
                )
            }
        ];
        return (
            <div className="goods-label clearfix">
                {/*面包屑*/}
                < Breadcrumb separator=">" >
                    <Breadcrumb.Item>微信管理</Breadcrumb.Item>
                    <Breadcrumb.Item>脂玫乐小程序</Breadcrumb.Item>
                    <Breadcrumb.Item>活动管理</Breadcrumb.Item>
                </Breadcrumb >
                <div style={{ marginTop: 30 }}>
                    <Form layout="inline" method="post">
                        <Row>
                            <Col span={8}>
                                <FormItem name="activity_namess" label="活动名称" >
                                    {getFieldDecorator('activity_namess', {
                                    })(
                                        <Input placeholder="请输入活动名称:" />

                                        )}
                                </FormItem>
                            </Col>
                            <Col span={8}>
                                <FormItem name="activity_status" label="活动状态" >
                                    {getFieldDecorator('activity_status', {
                                        initialValue: 'a',
                                    })(
                                        <Select placeholder="请选择活动状态" style={{ width: '100px', }}>
                                            <Option value="a">全部</Option>
                                            <Option value="0">未发布</Option>
                                            <Option value="9">已发布</Option>
                                            <Option value="2">下架</Option>
                                        </Select>

                                        )}
                                </FormItem>
                            </Col>
                            <Col span={8}>
                                <FormItem name="activity_time" label="时间状态" >
                                    {getFieldDecorator('activity_time', {
                                        onChange: this.handleTime.bind(this)
                                    })(
                                        <Select placeholder="请选择活动状态" style={{ width: '100px' }} >
                                            <Option value="1">限时</Option>
                                            <Option value="0">不限时</Option>
                                        </Select>

                                        )}
                                </FormItem>
                            </Col>
                        </Row>

                        <Row>
                            <FormItem label="展示时间" style={this.state.time1} >
                                {getFieldDecorator('times', )(
                                    <RangePicker showTime format="YYYY-MM-DD HH:mm:ss" />
                                )}
                            </FormItem>
                        </Row>
                        <Row>
                            <Col span='12'>
                            </Col>
                            <Col span='12'>
                                <FormItem style={{ float: 'right' }}>
                                    <Button onClick={this.submitReset.bind(this)}>重置</Button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" icon="search" onClick={this.getBennnerList.bind(this, 1)}>搜索</Button>
                                </FormItem>
                            </Col>
                        </Row>
                    </Form>
                </div>
                <div style={{ marginTop: 30 }}></div>
                <Row>
                    <Col span={2} offset={22}><Button type="primary" onClick={() => { this.setState({ visible: true, data: '', fileList: '',action: 1 ,status: '1',}) }}>新增活动</Button> </Col>
                </Row>
                <div className="clearfix dataManage">
                    <div className='allgoods-table clearfix' style={{ marginTop: '40px' }}>
                        <Table
                            rowKey="id"
                            columns={columns}
                            dataSource={this.state.activityList}
                            pagination={false}
                            bordered
                        />
                    </div>
                </div>
                <div className='goods-label-let'>
                    <div className="floor-ppagi">
                        {
                            this.state.activitycount === 0 ?
                                <p className="floor-ppagip">
                                    共{this.state.activitycount}条记录
                                </p> :
                                <p className="floor-ppagip">
                                    当前显示
                                    {15 * (this.state.pageindex - 1) + 1}—
                                    {15 * this.state.pageindex < this.state.activitycount ? 15 * this.state.pageindex : this.state.activitycount}条记录，
                                    共{this.state.activitycount}条记录
                                </p>
                        }
                        <Pagination showQuickJumper current={this.state.pageindex} total={this.state.activitycount || 1} defaultPageSize={20} onChange={this.changePage.bind(this)} />
                    </div>
                </div>
                <Modal visible={this.state.visible}
                    title={<p style={{ textAlign: "center" }}>{this.state.action == 1 ? '新增活动' : '编辑活动'}</p>}
                    okText="确定"
                    cancelText="取消"
                    footer={<div>
                        <Button onClick={this.handleCancel.bind(this)}>取消</Button>
                        <Button type="primary" onClick={this.handleSubmit.bind(this)}>确定</Button>
                    </div>}
                    onCancel={this.handleCancel.bind(this)}
                    maskClosable={false}
                >

                    <Form onSubmit={this.handleSubmit.bind(this)} >
                        <FormItem name="activity_name" label="活动名称" >
                            {getFieldDecorator('activity_name', {
                                initialValue: this.state.data.activity_name
                            })(
                                <Input placeholder="请输入活动名称:" />

                                )}
                        </FormItem>
                        <FormItem  label="活动图" >
                            {/* <div className={"thrt"}>轮播图</div> */}
                            {getFieldDecorator('banner_img', {
                                getValueFromEvent: this.normFile.bind(this),
                            })(
                                <Upload listType={"picture"} {...props} fileList={this.state.fileList}>
                                    <Button onClick={this.devs.bind(this)}>
                                        <Icon type="upload" />选择上传图片
                                        </Button>
                                </Upload>
                                )}<span>图片规格：宽690px乘高290px ，图片格式：jbmp,jpg,png,svg,psd</span>
                        </FormItem>

                        <FormItem  label="活动时间">
                            {/* <div className={"thrt"}>跳转类型</div> */}
                            {getFieldDecorator('status', {
                                rules: [{ required: true, message: '活动时间' }],
                                initialValue: this.state.status,
                                onChange: this.handleSelectChanges.bind(this)
                            })(
                                <Select placeholder="请选择跳转类型">
                                    <Option value="1">不限制</Option>
                                    <Option value="2">限制</Option>
                                </Select>
                                )}
                        </FormItem>
                        <FormItem label="上下线时间" style={this.state.time}>
                            {getFieldDecorator('time_range', { initialValue: [this.state.time_start, this.state.time_end] })(
                                <RangePicker showTime format="YYYY-MM-DD HH:mm:ss" />
                            )}
                        </FormItem>

                        <FormItem  label="跳转类型">
                            {/* <div className={"thrt"}>跳转类型</div> */}
                            {getFieldDecorator('type', {
                                rules: [{ required: true, message: '跳转类型' }],
                                initialValue: this.state.data.type == undefined ? '1' : this.state.data.type,
                                onChange: this.handleSelectChange.bind(this)
                            })(
                                <Select placeholder="请选择跳转类型">
                                    <Option value="1">不跳转</Option>
                                    <Option value="2">跳转图片</Option>
                                    <Option value="3">跳转url</Option>
                                </Select>
                                )}
                        </FormItem>
                        <FormItem name="url" label="跳转地址" style={this.state.url}>
                            {getFieldDecorator('url', {
                                initialValue: this.state.data.url
                            })(
                                <Input placeholder="请输入跳转地址" />
                                // <Select placeholder="请选择跳转活动">
                                //    {
                                //        this.state.activityAll.map((data,index)=>{
                                //         return <Option value={data.id.toString()} key={index}>{data.activity_name}</Option>
                                //        })
                                //    }
                                // </Select>
                                )}
                        </FormItem>

                        <FormItem  style={this.state.imgs} label="跳转图片">
                            <div className={"thrt"}>跳转图片</div>
                            {getFieldDecorator('img', {
                                getValueFromEvent: this.normFiles.bind(this),
                            })(
                                <Upload listType={"picture"} {...propss} fileList={this.state.fileLists}>
                                    <Button>
                                        <Icon type="upload" />选择上传图片
                                        </Button>
                                </Upload>
                                )}<span>图片规格：宽750px乘高810px ，图片格式：jbmp,jpg,png,svg,psd</span>
                        </FormItem>


                    </Form>
                </Modal>
                <Modal visible={this.state.visibles}
                    title='修改排序'
                    okText="确定"
                    cancelText="取消"
                    footer={<div>
                        <Button onClick={this.handleCancels.bind(this)}>取消</Button>
                        <Button type="primary" onClick={this.seq.bind(this)}>确定</Button>
                    </div>}
                    onCancel={this.handleCancels.bind(this)}
                    maskClosable={false}
                >
                    <FormItem name="seqs" label="序号" >
                        {getFieldDecorator('seqs', {
                            initialValue: this.state.seqs
                        })(
                            <InputNumber  />

                            )}<span>数字越小越在前(1-99) </span>
                    </FormItem>
                </Modal>

            </div>
        )
    }
}
const Login = Form.create()(LoginComponent);
export default Login;
